import java.lang.reflect.Array;
import java.util.Arrays;

public class Leet561 {
    public int arrayPairSum(int[] nums) {
        int r = 0;
        Arrays.sort(nums);
        for (int i = 0; i < nums.length-1; i+=2) {
            r+=nums[i];
        }
        return r;
    }

}
